package handler

import (
	"github.com/starmotioncf/soutchatinternal/dto"
	"github.com/starmotioncf/soutchatinternal/errcode"
	"github.com/starmotioncf/soutchatinternal/resp"
	"github.com/starmotioncf/soutchatinternal/service"

	"github.com/gin-gonic/gin"
)

type PaymentHandler struct {
	*Handler
	paymentService service.PaymentService
}

func NewPaymentHandler(h *Handler, paymentService service.PaymentService) *PaymentHandler {
	return &PaymentHandler{
		Handler:        h,
		paymentService: paymentService,
	}
}

//
//// GetPaymentMethods
//// @Tags h5支付
//// @Summary  获取支付方式-v2
//// @Description 获取支付方式，和产品列表
//// @Accept json
//// @param json body dto.PaymentMethodReq true "参数"
//// @Produce  json
//// @Response 200 {object} resp.Resp{res=[]dto.PaymentMethodItem}
//// @Router /payment/methods [post]
//func (h *PaymentHandler) GetPaymentMethods(ctx *gin.Context) {
//	req := dto.PaymentMethodReq{}
//	if err := ctx.BindJSON(&req); err != nil {
//		resp.Error(ctx, errcode.ErrRequest)
//		return
//	}
//	//data, err := h.paymentService.GetPaymentMethods(ctx, false, &req)
//	//resp.ReturnMustJson(ctx, data, err)
//}

// CreateOrder
// @Tags h5支付
// @Summary  创建订单-v2
// @Description 创建订单，和产品列表
// @Accept json
// @param json body dto.PaymentCreateOrderReq true "参数"
// @Produce  json
// @Response 200 {object} resp.Resp{res=dto.PaymentCreateOrderRes}
// @Router /payment/createOrder [post]
func (h *PaymentHandler) CreateOrder(ctx *gin.Context) {
	req := dto.PaymentCreateOrderReq{}
	if err := ctx.BindJSON(&req); err != nil {
		resp.Error(ctx, errcode.ErrRequest)
		return
	}
}

// QueryOrder
// @Tags h5支付
// @Summary  创建订单-v2
// @Description 创建订单，和产品列表
// @Accept json
// @param json body dto.PaymentQueryOrderReq true "参数"
// @Produce  json
// @Response 200 {object} resp.Resp{res=dto.PaymentQueryOrderRes}
// @Router /payment/queryOrder [post]
func (h *PaymentHandler) QueryOrder(ctx *gin.Context) {
	req := dto.PaymentQueryOrderReq{}
	if err := ctx.BindJSON(&req); err != nil {
		resp.Error(ctx, errcode.ErrRequest)
		return
	}
}

// Return
// @Tags h5支付
// @Summary  支付返回地址
// @Description paypal支付返回地址，可能 success|cancel,当success时进行捕获订单后，重定向到前端页面
// @param query path dto.PaymentPaypalReturn true "参数"
// @Produce  json
// @Response 200 {object} resp.Resp{res=dto.PaymentCreateOrderRes}
// @Router /payment/:channel/return [get]
func (h *PaymentHandler) Return(ctx *gin.Context) {
	//req := dto.PaymentPaypalReturn{}
}

// Notify
// @Tags h5支付
// @Summary  支付异步通知地址
// @Description paypal支付返回地址，可能 success|cancel,当success时进行捕获订单后，重定向到前端页面
// @param query path dto.PaymentPaypalReturn true "参数"
// @Produce  json
// @Response 200 {object} resp.Resp{res=dto.PaymentCreateOrderRes}
// @Router /payment/:channel/notify [get]
func (h *PaymentHandler) Notify(ctx *gin.Context) {
	//req := dto.PaymentPaypalReturn{}
}
